import torch
from torch import nn

import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

import numpy as np

torch.manual_seed(10)


# ====================数据====================
sample_nums = 100
mean_value = 1.7
bias = 1
n_data = torch.ones(sample_nums, 2)

m_n = mean_value * n_data

x0 = torch.normal(m_n, 0.5) + bias
y0 = torch.zeros(sample_nums)

x1 = torch.normal(-1 * m_n, 1) + bias
y1 = torch.ones(sample_nums)
train_x = torch.cat((x0, x1), dim=0)
train_y = torch.cat((y0, y1), dim=0)

plt.scatter(x0.data.numpy()[:, 0], x0.data.numpy()[:, 1], c='r', label='class 0')
# plt.scatter(x1.data.numpy()[:, 0], x1.data.numpy()[:, 1], c='b', label='class 1')
plt.show()
